package org.shangrila.app.sys.eo;

import java.io.Serializable;

import javax.persistence.*;

import java.util.List;


/**
 * The persistent class for the SYS_AUTHORITY database table.
 * 
 */
@Entity
@Table(name="SYS_AUTHORITIES")
@NamedQuery(name="SysAuthority.findAll", query="SELECT s FROM SysAuthority s")
public class SysAuthority implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private long id;

	private String description;

	private String flag;

	private String name;

	//bi-directional many-to-one association to SysMenus
	@OneToMany(mappedBy="sysAuthority")
	private List<SysMenus> sysMenuses;

	//bi-directional many-to-many association to SysResource
	@ManyToMany(mappedBy="sysAuthorities")
	private List<SysResource> sysResources;

	//bi-directional many-to-many association to SysRole
	@ManyToMany(mappedBy="sysAuthorities")
	private List<SysRole> sysRoles;

	//bi-directional many-to-many association to SysUser
	@ManyToMany(mappedBy="sysAuthorities")
	private List<SysUser> sysUsers;

	public SysAuthority() {
	}
	public SysAuthority(long id,String name) {
		this.id = id;
		this.name = name;
	}
	public long getId() {
		return this.id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getFlag() {
		return this.flag;
	}

	public void setFlag(String flag) {
		this.flag = flag;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<SysMenus> getSysMenuses() {
		return this.sysMenuses;
	}

	public void setSysMenuses(List<SysMenus> sysMenuses) {
		this.sysMenuses = sysMenuses;
	}

	public SysMenus addSysMenus(SysMenus sysMenus) {
		getSysMenuses().add(sysMenus);
		sysMenus.setSysAuthority(this);

		return sysMenus;
	}

	public SysMenus removeSysMenus(SysMenus sysMenus) {
		getSysMenuses().remove(sysMenus);
		sysMenus.setSysAuthority(null);

		return sysMenus;
	}

	public List<SysResource> getSysResources() {
		return this.sysResources;
	}

	public void setSysResources(List<SysResource> sysResources) {
		this.sysResources = sysResources;
	}

	public List<SysRole> getSysRoles() {
		return this.sysRoles;
	}

	public void setSysRoles(List<SysRole> sysRoles) {
		this.sysRoles = sysRoles;
	}

	public List<SysUser> getSysUsers() {
		return this.sysUsers;
	}

	public void setSysUsers(List<SysUser> sysUsers) {
		this.sysUsers = sysUsers;
	}

}